import {mapState} from 'vuex'

export default {
	computed: {
		...mapState(['userInfo'])
	},
	methods: {
		NAVPAGE(str, num = 1) {
			if (num == 2) {
				if (this.isLoading()) return
				uni.navigateTo({
					url: str
				})
			} else {
				uni.navigateTo({
					url: str
				})
			}
		},
		isLoading() {
			if (!this.userInfo) {
				uni.$u.toast('请登录')
				
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/msyng/Register/login'
					})
				}, 1000)
				return true
			}
			return false
		},
		$msg(msg) {
			uni.showToast({
				title: msg,
				duration: 2000,
				position: 'center',
				icon: 'none'
			})
		}
	},
	filters: {
		GoZero(number) {
			return parseFloat(number).toString()
		}
	},
	onHide() {
		uni.hideLoading()
	}
}